class Main {
        public static String addBinary(String a, String b) {
            StringBuilder str = new StringBuilder();
            int t = 0,n = a.length() - 1,m = b.length() - 1;
            while (n >= 0 || m >= 0 || t != 0){
                if(n >= 0) t += a.charAt(n --) - '0';
                if(m >= 0) t += b.charAt(m --) - '0';
                str.append(t % 2);
                t /= 2;
            }
            return str.reverse().toString();
        }

    public static void main(String[] args) {
        String a = "1010";
        String b = "1011";
        System.out.println(addBinary(a,b));
    }
}
